<!DOCTYPE html>
<html xmlns:layout="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
	layout:decorate="~{common/layout}">

<head>
	<meta charset="UTF-8">
	<title>在线测验系统</title>
	<style scoped lang="less">

	</style>
</head>

<body>
	<div layout:fragment="fragment_body">
		<van-row>
			<!--<van-search v-model="value" show-action placeholder="请输入搜索关键词" @search="onSearch">
				<template #action>
					<div @click="onSearch">搜索</div>
				</template>
			</van-search>-->
			<van-tabs v-model="query.type" @click="onClickTab">
			  <van-tab title="章节练习" name="0"></van-tab>
			  <van-tab title="测验测试" name="1"></van-tab>
			</van-tabs>
		</van-row>
		<van-row>
			<van-cell center :title="record.chapter.chapterTitle" label="" v-for="record in records" :key="record.recordId">
				<template #right-icon>
			    	<div>
			    	<van-tag size="mini" plain type="warning" v-if="record.recordStatus*1 === 0" >未提交</van-tag>
			    	<van-tag size="mini" plain type="danger" v-if="record.recordStatus*1 === 1" >暂存中</van-tag>
			    	<van-tag size="mini" plain type="success" v-if="record.recordStatus*1 === 2" >已提交</van-tag>
			    	<br><span>{{record.recordScore}}分</span>
			    	</div>
			    </template>
			</van-cell>
			<van-empty v-if="records == null || records.length == 0" description="暂无记录" />
		</van-row>
	</div>
</body>
<script type="text/javascript" layout:fragment="fragment_script">
	let vueData = {
		activeMenu: 'record',
		//value: '',
		records: [],
		query:{
			type: 0,
			accountId: getLoginId()
		}
	}
	let vueMethods = {
		//onSearch(){
			
		//},
		onClickTab(name, title) {
			let that = this
	      	that.getRecords();
	    },
		getRecords() {
			let that = this
			postRequst('/user/getRecords', that.query, true).then(function (resp) {
				that.records = resp.rows
			})
		},
	}
	function vueCreated() {
		let that = this
		that.getRecords()
	}
</script>

</html>